package com.dmgis.hndz.service;

import com.baomidou.dynamic.datasource.annotation.DS;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dmgis.hndz.pojo.TownshipStation;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
@DS("qx")
public interface TownshipStationMapper extends BaseMapper<TownshipStation> {

    @Select("select StationID, StationName, min((Longitude - ${jd}) * (Longitude - ${jd}) + (Latitude - ${wd}) * (Latitude - ${wd})) as Longitude " +
            "from township_station " +
            "where city = ${city} " +
            "order by min((Longitude - {jd}) * (Longitude - {jd}) + (Latitude - {wd}) * (Latitude - {wd})) " +
            "limit 1")
    List<TownshipStation> selectList2(String jd, String wd, String city);

    @Select("select distinct stationid, stationname, Longitude, Latitude " +
            "from township_station " +
            "where city like #{city}")
    List<TownshipStation> selectList1(String city);

    @Select("select distinct StationName , Longitude, Latitude " +
            "from township_station " )
    List<TownshipStation> selectList3();


}
